<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <!-- 满足有些用户在手机端访问的需要 -->

    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">

    <title>用户管理</title>
    <!-- 线上环境 -->
    <link rel="stylesheet" href="/static/css/dist/component-min.css">
    <link rel="stylesheet" href="/static/plugins/jbox/jbox-min.css">

    <!--vue-->
    <script src="/static/vue/vue.js"></script>
    <!--element ui-->
    <script src="/static/element/index.js"></script>
    <link rel="stylesheet" href="/static/element/index.css">
    <style>
        .el-table__empty-block {
            height: 0;
        }
        .img-delete:before {
            position: absolute;
            top: -5px;
            color: red;
            margin-left: -15px;
            z-index: 999;
        }
    </style>

</head>
<body class="cp-bodybox">
<div id="app">
    <#include "/common/header-fg.html" />

    <div class="container">
        <div class="inner clearfix">
            <#include "/common/left-menu-fg.html" />

            <div class="content-right">
                <h1 style="line-height: 36px"v-text="headerTitle">{{headerTitle}}</h1>
                <el-card class="box-card">
                    <el-tabs v-model="activeName2" type="card">
                        <el-tab-pane label="基本信息" name="first">
                            <el-form ref="itemMessage1" :model="itemMessage" :rules="activeRules2" :inline="true" label-width="120px">
                               <el-row :span="24">
                                   <el-col :span="12">
                                       <el-form-item label="商品种类">
                                           <el-radio-group v-model="checkedTags"  style="line-height: 36px;">
                                               <el-radio v-for="tag in Tags" :label="tag.value" disabled>{{tag.name}}</el-radio>
                                           </el-radio-group>
                                       </el-form-item>
                                   </el-col>
                                   <el-col :span="12">
                                       <el-form-item label="商品类目">
                                           <div class="block">
                                               <el-cascader
                                                       :disabled="true"
                                                       expand-trigger="hover"
                                                       :change-on-select="true"
                                                       :options="typeList"
                                                       :disabled=readonly
                                                       v-model="typeIds">
                                               </el-cascader>
                                           </div>
                                       </el-form-item>
                                   </el-col>
                               </el-row>
                                <el-row :span="24">
                                    <el-col :span="12">
                                        <el-form-item label="商品名" prop="name">
                                            <el-input v-model="itemMessage.name" :disabled="readonly" ></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="标题">
                                            <el-input v-model="itemMessage.title" :disabled=readonly ></el-input>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="商家">
                                            <el-input v-model="itemMessage.orgName" disabled></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="状态">
                                            <el-select v-model="itemMessage.status" disabled placeholder="请选择状态">
                                                <el-option
                                                        v-for="item in statusList"
                                                        :label="item.name"
                                                        :value="item.value">
                                                </el-option>
                                            </el-select>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="描述" prop="desc">
                                           <el-input v-model="itemMessage.desc" :rows="5" type="textarea" style="width:500px" :disabled=readonly ></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="缩略图" prop="thumbnail">
                                            <el-row>
                                                <img height="100" v-if="itemMessage.thumbnail !== ''" :src="qiniuUrl + itemMessage.thumbnail">
                                                <i class="el-icon-circle-close img-delete" v-if="itemMessage.thumbnail !== '' && !readonly" @click="deleteImg">
                                                </i>
                                                <el-upload
                                                        v-if="!readonly"
                                                        :before-upload="beforeUpload"
                                                        style="display: inline-block"
                                                        :show-file-list="false"
                                                        action="/file/upload"
                                                        :on-success="uploadSuccess">
                                                    <el-button size="small" type="primary">点击上传</el-button>
                                                    <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
                                                </el-upload>
                                            </el-row>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row :span="24">
                                    <el-col :span="24">
                                        <el-form-item label="是否限购">
                                            <el-switch on-text="" off-text="" v-model="itemMessage.limit" :disabled=readonly style="margin-top: 8px"></el-switch>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row :span="24">
                                    <el-col :span="12" v-if="itemMessage.limit">
                                        <el-form-item label="限购数量" :inline="true">
                                            <el-row :gutter="14">
                                                <el-col :span="12">
                                                    <el-input v-model="itemMessage.limitNumber" :disabled=readonly ></el-input>
                                                </el-col>
                                                <el-col :span="3">
                                                    <el-input v-model="itemMessage.unit" placeholder="件" :disabled=readonly ></el-input>
                                                </el-col>
                                            </el-row>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="库存" :inline="true">
                                            <el-row :gutter="14">
                                                <el-col :span="12">
                                                    <el-input v-model="itemMessage.stock" :disabled=readonly ></el-input>
                                                </el-col>
                                                <el-col :span="3">
                                                    <el-input v-model="itemMessage.unit" placeholder="件" :disabled=readonly ></el-input>
                                                </el-col>
                                            </el-row>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row :span="24">
                                    <el-col :span="12" v-if="checkedTags === 10">
                                        <el-form-item label="原价" prop="initialPrice">
                                            <el-input v-model.number="itemMessage.initialPrice" :disabled=readonly ></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="现价" prop="salePrice">
                                            <el-input v-model.number="itemMessage.salePrice" :disabled=readonly ></el-input>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row :span="24">
                                    <el-col :span="12">
                                        <el-form-item label="积分兑换数" prop="usePoint">
                                            <el-input v-model.number="itemMessage.usePoint" :disabled=readonly ></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12" v-if="readonly">
                                        <el-form-item label="分销金额" prop="usePoint">
                                            <el-input v-model.number="itemMessage.spreadSale" disabled></el-input>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                            </el-form>
                        </el-tab-pane>
                        <el-tab-pane label="商品属性" name="second">
                            <el-form :inline="true" ref="itemMessage2" :model="propertyForm" label-width="10px">
                                <el-row :gutter="10" v-for="(item, index) in propertyForm.defaultProperty">
                                    <el-col :span="2">
                                        <el-form-item v-if="item.require" :prop="'defaultProperty.' + index + '.propertyName'"
                                                      :rules="{required: true, message: '属性名不能为空'}">
                                            <el-input v-model='item.propertyName' :disabled='item.require || readonly'></el-input>
                                        </el-form-item>
                                        <el-form-item v-else>
                                            <el-input v-model='item.propertyName' :disabled='item.require || readonly'></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="4">
                                        <el-form-item v-if="item.require" :prop="'defaultProperty.' + index + '.propertyValueName'"
                                                      :rules="{required: true, message: '属性值不能为空'}">
                                            <el-input  v-model='item.propertyValueName' :disabled='item.require || readonly'></el-input>
                                        </el-form-item>
                                        <el-form-item v-else>
                                            <el-input  v-model='item.propertyValueName'></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="2">
                                        <el-button @click.native.prevent="removeRow(item)" v-if="readonly">删除</el-button>
                                    </el-col>
                                </el-row>
                            </el-form>
                            <el-form :inline="true" ref="itemMessage3" :model="propertyForm" label-width="10px">
                                <el-row :gutter="10" v-for="(item, index) in propertyForm.propertyList">
                                    <el-col :span="2">
                                        <el-form-item :prop="'propertyList.' + index + '.propertyName'"
                                                      :rules="{required: true, message: '属性名不能为空'}">
                                            <el-input v-model='item.propertyName' placeholder="属性名" :disabled="readonly"></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="4">
                                        <el-form-item :prop="'propertyList.' + index + '.propertyValueName'"
                                                      :rules="{required: true, message: '属性值不能为空'}">
                                            <el-input  v-model='item.propertyValueName' :disabled="readonly"></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="2">
                                        <el-button @click.prevent="removeDomain(item)" v-if="!readonly">删除</el-button>
                                    </el-col>
                                </el-row>
                                <el-form-item style="margin-left: 160px" v-if="!readonly">
                                    <el-row :span="24">
                                        <el-col :span="24">
                                            <el-button type="primary" @click="addNew">添加</el-button>
                                        </el-col>
                                    </el-row>
                                </el-form-item>
                            </el-form>
                        </el-tab-pane>
                        <el-tab-pane label="商品图片" name="third">
                            <el-card class="box-card" style="margin-top: 10px">
                                <div slot="header" class="clearfix">
                                    <span style="line-height: 36px;">预览图(4张)</span>
                                    <span style="float: right">
                                        <el-upload
                                                v-if="!readonly"
                                                :before-upload="beforeUpload"
                                                style="display: inline-block"
                                                :show-file-list="false"
                                                action="/file/upload"
                                                :on-success="uploadBannerSuccess">
                                                <el-button type="primary">添加</el-button>
                                        </el-upload>
                                    </span>
                                </div>
                                <el-table
                                        :data="bannerList"
                                        border
                                        style="width: 100%">
                                    <el-table-column
                                            type="index"
                                            label="序号"
                                            width="80">
                                    </el-table-column>
                                    <el-table-column
                                            inline-template
                                            label="图片">
                                        <div style="padding: 5px 0"><img height="50" v-if="row.picUrl !== ''" :src="qiniuUrl + row.picUrl"></div>
                                    </el-table-column>
                                    <el-table-column
                                            inline-template
                                            label="创建人">
                                        <div>{{user.userName}}</div>
                                    </el-table-column>
                                    <el-table-column
                                            prop="insertTime"
                                            label="创建时间">
                                    </el-table-column>
                                    <el-table-column
                                            align="center"
                                            label="操作"
                                            inline-template
                                            width="180">
                                        <div style="margin-left: -10px">
                                            <el-dropdown>
                                                <el-button size="small" type="primary" :disabled=readonly >
                                                    操作<i class="el-icon-caret-bottom el-icon--right"></i>
                                                </el-button>
                                                <el-dropdown-menu slot="dropdown" align="center">
                                                    <el-dropdown-item><el-button size="mini" v-if="$index !== 0" type="primary" class="el-icon-edit" @click.native.prevent="exchange($index, 'banner')">上移</el-button></el-dropdown-item>
                                                    <el-dropdown-item><el-button size="mini" type="primary" class="el-icon-edit" @click.native.prevent="deleteBanner($index)">删除</el-button></el-dropdown-item>
                                                </el-dropdown-menu>
                                            </el-dropdown>
                                        </div>
                                    </el-table-column>
                                </el-table>
                            </el-card>
                            <el-card style="margin-top: 15px">
                                <div slot="header" class="clearfix">
                                    <span style="line-height: 36px;">详情图(4张)</span>
                            <span style="float: right">
                                <el-upload
                                        v-if="!readonly"
                                        :before-upload="beforeUpload"
                                        style="display: inline-block"
                                        :show-file-list="false"
                                        action="/file/upload"
                                        :on-success="uploadPicSuccess">
                                        <el-button type="primary">添加</el-button>
                                </el-upload>
                            </span>
                                </div>
                                <el-table
                                        :data="pictureList"
                                        border
                                        style="width: 100%">
                                    <el-table-column
                                            type="index"
                                            label="序号"
                                            width="80">
                                    </el-table-column>
                                    <el-table-column
                                            inline-template
                                            label="图片">
                                        <div style="padding: 5px 0"><img height="50" v-if="row.picUrl !== ''" :src="qiniuUrl + row.picUrl"></div>
                                    </el-table-column>
                                    <el-table-column
                                            inline-template
                                            label="创建人">
                                        <div>{{user.userName}}</div>
                                    </el-table-column>
                                    <el-table-column
                                            prop="insertTime"
                                            label="创建时间">
                                    </el-table-column>
                                    <el-table-column
                                            align="center"
                                            label="操作"
                                            inline-template
                                            width="180">
                                        <div style="margin-left: -10px">
                                            <el-dropdown>
                                                <el-button size="small" type="primary" :disabled=readonly >
                                                    操作<i class="el-icon-caret-bottom el-icon--right"></i>
                                                </el-button>
                                                <el-dropdown-menu slot="dropdown" align="center">
                                                    <el-dropdown-item><el-button size="mini" type="primary" class="el-icon-edit" @click.native.prevent="exchange($index, 'picture')">上移</el-button></el-dropdown-item>
                                                    <el-dropdown-item><el-button size="mini" type="primary" class="el-icon-edit" @click.native.prevent="deletePic($index)">删除</el-button></el-dropdown-item>
                                                </el-dropdown-menu>
                                            </el-dropdown>
                                        </div>
                                    </el-table-column>
                                </el-table>
                            </el-card>
                        </el-tab-pane>
                    </el-tabs>
                </el-card>
                <div style="text-align: center;margin-top: 10px" v-if="!readonly">
                    <el-button type="primary" @click.native.prevent="save">保存</el-button>
                    <el-button @click.native.prevent="cancel">取消</el-button>
                </div>
            </div>
        </div>
            <!-- end content-right -->

            <a href="javascript:;" class="btn-leftMenuFold" id="j-btn-leftMenuFold"></a>
    </div>

    <!-- end container -->

    <!--gonggao-->

    <!--tip-->
    <div class="footer">© 2017 , Inc. All rights reserved.</div>
    <!-- end footer -->
    <div class="fixedBar" style="right: -78px;">
        <ul>
            <template v-for="(item, index) in leftMenuList">
                <li v-if="index==0" :class="'shopManager' + index + ' cur'"><a href="javascript:;" :data-target="'#shop_' + index">{{item.groupName}}</a></li>
                <li v-else :class="'shopManager' + index"><a href="javascript:;" :data-target="'#shop_' + index">{{item.groupName}}</a></li>
            </template>
        </ul>
        <a href="javascript:;" class="fixedBar-btn" id="j-fixedBar-btn"></a>
    </div>
    <a href="#" id="j-gotop" class="gotop" title="回到顶部" style="left: 1920.59px;"></a>

</div>
<script src="/static/js/dist/lib-min.js"></script>
<script src="/static/js/dist/list.js"></script>
<script src="/static/js/dist/component-min.js"></script>

<!-- 引入api -->
<script src="/static/js/api.js"></script>
<script>
    new Vue({
        el: '#app',
        data: function(){
            return {
                user: ${(user)!'null'},
                activeRules2: {
                    name: [
                        {required: true, message: "商品名称不能为空"}
                    ],
                    desc: [
                        {required: true, message: "商品描述不能为空"}
                    ],
                    initialPrice: [
                        {required: true, message: "请输入原价"},
                        {type: "number", message: '原价必须为数字'}
                    ],
                    salePrice: [
                        {required: true, message: "请输入现价"},
                        {type: "number", message: '现价必须为数字'}
                    ],
                    usePoint: [
                        {required: true, message: "请输入积分兑换数"},
                        {type: "number", message: '积分兑换数必须为数字'}
                    ],
                    thumbnail: [
                        {required: true, message: "请上传图片"}
                    ]
                },
                readonly: ${readonly},
                headerNavList: list.headerNavList,
                accountNavList: list.accountNavList,
                leftMenuList: list.menu,
                checkedTags: '',
                qiniuUrl: list.qiniuUrl,
                typeIds: [],
                Tags: [
                    {
                        name:'商品',
                        value:10
                    },
                    {
                        name: '服务',
                        value:11
                    }
                ],
                activeName2: 'first',
                pictureList:[],
                headerTitle:'',
                detail: ${detail},
                itemMessage: {},
                options: [],
                typeList: [],
                propertyForm: {
                    defaultProperty: [],
                    propertyList: [],
                },
                bannerList: [],
                statusList: []
            }
        },
        mounted:function () {
            this.getStatus();
            this.editOrDetail();
            this.getType();
        },
        watch: {
            checkedTags: function (val, oldVal) {
                let that = this;
                if (val !== "") {
                    this.options.forEach(function (item) {
                        if (item.value === val) {
                            that.typeList = item.children;
                        }
                    })
                }
            }
        },
        methods: {
            addNew(){
                this.propertyForm.propertyList.push({
                    propertyName:'',
                    propertyId:'',
                    propertyValueName:''
                })
            },
            deleteImg () {
                this.itemMessage.thumbnail = "";
            },
            getStatus () {
                let that = this;
                this.$get("/dictionary/list/MS_ITEM_STATUS", {}, function (res) {
                    if (res.status === 100) {
                        that.statusList = res.returnValue;
                    } else {
                        that.$alert('服务器错误','提示',{
                            confirmButtonText:'确定',
                        })
                    }
                }, function (res) {
                    that.$alert('服务器错误','提示',{
                        confirmButtonText:'确定',
                    })
                })
            },
            removeDomain(item){
                var index = this.propertyForm.propertyList.indexOf(item)
                if(index !== -1){
                    this.propertyForm.propertyList.splice(index,1)
                }
            },
            beforeUpload (file) {
                if (file.type === "image/png") {
                    this.imgType = ".png";
                    return true;
                } else if (file.type === "image/jpeg") {
                    this.imgType = ".jpg";
                    return true;
                } else {
                    this.$message.error('上传头像图片只能是 JPG 或 png 格式!');
                    return false;
                }
            },
            uploadSuccess (response, file) {
                if (response.status === 100) {
                    this.itemMessage.thumbnail = response.returnValue[0].id + this.imgType;
                    this.imgLoading = false;
                } else {
                    this.imgLoading = false;
                    this.$alert('上传失败', '提示', {
                        confirmButtonText: '确定',
                    });
                }
            },
            uploadBannerSuccess (response, file) {
                if (response.status === 100) {
                    let obj = {
                        picUrl: response.returnValue[0].id + this.imgType,
                        type: 1,
                        insertTime: this.getNow()
                    }
                    this.bannerList.push(obj);
                } else {
                    this.$alert('上传失败', '提示', {
                        confirmButtonText: '确定',
                    });
                }
            },
            uploadPicSuccess (response, file) {
                if (response.status === 100) {
                    let obj = {
                        picUrl: response.returnValue[0].id + this.imgType,
                        type: 2,
                        insertTime: this.getNow()
                    }
                    this.pictureList.push(obj);
                } else {
                    this.$alert('上传失败', '提示', {
                        confirmButtonText: '确定',
                    });
                }
            },
            save () {
                let that = this;
                // 数据验证
                let isValid1 = true;
                let isValid2 = true;
                let isValid3 = true;
                this.$refs.itemMessage1.validate(function (valid) {
                    if (!valid) {
                        that.$message.error('请完善基本信息');
                        isValid1 = false;
                    }
                })
                this.$refs.itemMessage2.validate(function (valid) {
                    if (!valid) {
                        that.$message.error('请完善属性信息');
                        isValid2 = false;
                    }
                })
                this.$refs.itemMessage3.validate(function (valid) {
                    if (!valid) {
                        that.$message.error('请完善属性信息');
                        isValid3 = false;
                    }
                })
                if (isValid1 && isValid2 && isValid3) {
                    let itemProperties = [];
                    let itemPictures = [];
                    itemProperties = itemProperties.concat(this.propertyForm.defaultProperty);
                    itemProperties = itemProperties.concat(this.propertyForm.propertyList);
                    itemPictures = itemPictures.concat(this.bannerList);
                    itemPictures = itemPictures.concat(this.pictureList);
                    this.itemMessage.itemProperties = itemProperties;
                    this.itemMessage.itemPictures = itemPictures;
                    this.itemMessage.limit = this.itemMessage.limit ? 1 : 0;
                    let loading = this.$loading({fullscreen: true, lock: true});
                    this.http("/item/update", this.itemMessage, function (res) {
                        if (res.status === 200) {
                            loading.close();
                            that.$alert('编辑成功','提示',{
                                confirmButtonText:'确定',
                                callback: function () {
                                    window.location.href = "/item/index";
                                }
                            })
                        } else {
                            loading.close();
                            that.$alert('编辑失败','提示',{
                                confirmButtonText:'确定',
                            })
                        }
                    }, function (res) {
                        loading.close();
                        that.$alert('编辑失败','提示',{
                            confirmButtonText:'确定',
                        })
                    })
                }
            },
            removeRow(item){
                var index = this.propertyForm.defaultProperty.indexOf(item)
                if(index !== -1){
                    this.propertyForm.defaultProperty.splice(index,1)
                }
            },
            deletePic (index) {
                this.pictureList.splice(index, 1);
            },
            deleteBanner (index) {
                this.bannerList.splice(index, 1);
            },
            exchange (index, str) {
                if (index === 0) {
                    return
                }
                if (str === "banner") {
                    this.bannerList[index -1] = this.bannerList.splice(index, 1, this.bannerList[index - 1])[0];
                } else {
                    this.pictureList[index -1] = this.pictureList.splice(index, 1, this.pictureList[index - 1])[0];
                }
            },
            getType () {
                let that = this;
                let loading = this.$loading({fullscreen: true, lock: true});
                this.$get("/item/type/tree", {}, function (res) {
                    if (res.status === 200) {
                        that.options = res.data.options;
                        that.options.forEach(function (item) {
                            if (item.value === that.checkedTags) {
                                that.typeList = item.children;
                            }
                        })
                        loading.close();
                    } else {
                        loading.close();
                        that.$alert('服务器错误','提示',{
                            confirmButtonText:'确定',
                        })
                    }
                }, function (res) {
                    loading.close();
                    that.$alert('服务器错误','提示',{
                        confirmButtonText:'确定',
                    })
                })
            },
            editOrDetail(){
                let detail = this.detail;
                this.checkedTags = detail.typeIds[0];
                this.typeIds = detail.typeIds.filter(function (item) {
                    return detail.typeIds.indexOf(item) !== 0;
                });
                let that = this;
                detail.itemProperties.forEach(function (item) {
                    let obj = {};
                    if (item.require !== undefined) {
                        obj = {
                            propertyId: item.propertyId,
                            propertyValueName: item.propertyValueName !== undefined ? item.propertyValueName : "",
                            propertyName: item.name,
                            require: item.require === 1 ? true : false
                        }
                        that.propertyForm.defaultProperty.push(obj);
                    } else {
                        obj = {
                            propertyName: item.propertyName,
                            propertyId: item.propertyId,
                            propertyValueName: item.propertyValueName
                        }
                        that.propertyForm.propertyList.push(obj)
                    }
                })
                detail.itemPictures.forEach(function (item) {
                    if (item.type === 1) {
                        that.bannerList.push(item);
                    } else if (item.type === 2) {
                        that.pictureList.push(item);
                    }
                })
                this.itemMessage = {
                    id: detail.id !== undefined ? detail.id : "",
                    name: detail.name !== undefined ? detail.name : "",
                    title: detail.title !== undefined ? detail.title : "",
                    typeName: detail.typeName !== undefined ? detail.typeName : "",
                    orgName: detail.orgName !== undefined ? detail.orgName : "",
                    desc: detail.desc !== undefined ? detail.desc : "",
                    stock: detail.stock !== undefined ? detail.stock : "",
                    status: detail.status !== undefined ? detail.status + "" : "",
                    expiry: detail.expiry !== undefined ? detail.expiry : "",
                    unit: detail.unit !== undefined ? detail.unit : "",
                    warningStock: detail.warningStock !== undefined ? detail.warningStock : "",
                    limit: detail.limit !== undefined ? (detail.limit === 1 ? true : false) : false,
                    limitNumber: detail.limitNumber !== undefined ? detail.limitNumber : "",
                    thumbnail: detail.thumbnail !== undefined ? detail.thumbnail : "",
                    typeId: detail.typeId !== undefined ? detail.typeId : "",
                    initialPrice: detail.initialPrice !== undefined ? detail.initialPrice : "",
                    salePrice: detail.salePrice !== undefined ? detail.salePrice : "",
                    usePoint: detail.usePoint !== undefined ? detail.usePoint : "",
                    weight: detail.weight !== undefined ? detail.weight : "",
                    volume: detail.volume !== undefined ? detail.volume : "",
                    itemProperties: [],
                    itemPictures: []
                }
                if(this.readonly){
                    this.headerTitle = '商品详情';

                }else{
                    this.headerTitle = '商品编辑';
                }
            }
        }
    })
</script>

<!-- 20170105 --></body>
</html>